package edu.zju.gis.dbfg.model.index;

import lombok.Getter;
import lombok.Setter;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Serializable;

@Getter
@Setter
public class FragmentIndexArgs implements Serializable {
    private final static Logger logger = LoggerFactory.getLogger(FragmentIndexArgs.class);

    @Option(name="-output", usage = "输出文件路径", required = true)
    private String output;

    @Option(name = "-input", usage ="输入文件路径", required = true)
    private String input;

    @Option(name = "-type", usage ="输入文件类型", required = true)
    private String type;

    @Option(name = "-idIndex", usage ="id字段", required = true)
    private String idIndex;

    @Option(name = "-dlbmIndex", usage ="dlbm字段", required = true)
    private String dlbmIndex;

    @Option(name = "-areaIndex", usage ="面积字段", required = true)
    private String areaIndex;

    @Option(name = "-zldwdmIndex", usage ="行政区划字段", required = true)
    private String zldwdmIndex;

    @Option(name = "-level", usage ="指标计算级别", required = true)
    private String level;

    @Option(name = "-crs", usage ="坐标系", required = true)
    private String crs;

    public static FragmentIndexArgs initArgs(String args[]) {
        FragmentIndexArgs mArgs = new FragmentIndexArgs();
        CmdLineParser parser = new CmdLineParser(mArgs);
        try {
            parser.parseArgument(args);
            return mArgs;
        } catch (CmdLineException e) {
            logger.error((e.getLocalizedMessage()));
            return null;
        }
    }
}
